\( \newcommand{\water}{{\rm H_{2}O}} \newcommand{\R}{\mathbb{R}} \newcommand{\N}{\mathbb{N}} \newcommand{\Z}{\mathbb{Z}} \newcommand{\Q}{\mathbb{Q}} \newcommand{\E}{\mathbb{E}} \newcommand{\d}{\mathop{}\!\mathrm{d}} \newcommand{\grad}{\nabla} \newcommand{\T}{^\text{T}} \newcommand{\mathbbone}{\unicode{x1D7D9}} \renewcommand{\:}{\enspace} \DeclareMathOperator*{\argmax}{arg\,max} \DeclareMathOperator*{\argmin}{arg\,min} \DeclareMathOperator{\Tr}{Tr} \newcommand{\norm}[1]{\lVert #1\rVert} \newcommand{\KL}[2]{ \text{KL}\left(\left.\rule{0pt}{10pt} #1 \; \right\| \; #2 \right) } \newcommand{\slashfrac}[2]{\left.#1\middle/#2\right.} \)

Random variable: A map from a probability space to a measurable space

Gist

Suppose we want to model a random system. Let \(\; (\Omega, \mathcal{F}, P) \;\) be a probability space and \(\; (E, \mathcal{E}) \;\) be a measurable space.

A random variable is the missing piece: it is the function that relates each latent outcome \(\; w \in \Omega \;\) to its corresponding visible outcome \(\; e \in E \;\)

Formal definition

Let \(\; (\Omega, \mathcal{F}, P) \;\) be a probability space and \(\; (E, \mathcal{E}) \;\) be a measurable space. Then, a \(\; (E, \mathcal{E})\)-valued random variable is a measurable function \(\; X: \Omega \to E \;\).

(Remember: measurable function means that there is a correspondence between events in the target sigma algebra \(\; \mathcal{E} \;\) and the origin sigma algebra \(\; \mathcal{F} \;\).)

Why this dual definition, with two measurable spaces?

This definition enables us to assign a probability to every subset in the target space \(\; B \in \mathcal{E} \;\) by looking at its preimage on the original space (domain), which is measurable by assumption.

This is useful because, while we could avoid this duplicity by defining a new probability space for each random system, it allows us to define many random variables from the same underlying random process, which happens often in real life. For example, if the underlying random process is throwing a die, and which side the die falls on, you could define all the following random variables from it:

NOTE You are always allowed to define the same target (observable) measurable space as the origin (underlying) measurable space. In this case, the origin sample space would be the same as the target state space, and the random variable would just be the identity.

NOTE The above point leads to many people making simplifications without realizing when thinking about random variables.


References

1 https://en.wikipedia.org/wiki/Random_variable#Measure-theoretic_definition